package com.hulk.dryad.common.exception;



import com.hulk.dryad.common.constant.enums.BEC;
import lombok.Getter;
import lombok.Setter;

/**
 * @author hulk
 */
public class BaseRteException extends RuntimeException {

    private static final long serialVersionUID = -1L;

    @Getter
    @Setter
    private int errCode;
    @Getter
    @Setter
    private String errDesc;
    @Getter
    @Setter
    protected String errJson;
    @Getter
    @Setter
    public BEC bec;


    /**
     * 构造方法
     *
     * @param bec 错误枚举
     */
    public BaseRteException(BEC bec) {
        this.setErrCode(bec.getErrCode());
        this.setErrDesc(bec.getErrDesc());
        this.bec = bec;
    }

    /**
     * 构造函数
     *
     * @param throwable Throwable
     */
    public BaseRteException(Throwable throwable) {
        super(throwable.getMessage());
        this.errCode = errCode;
        this.errDesc = throwable.getMessage();
    }

    /**
     * 构造函数
     *
     * @param errCode 错误代码
     * @param throwable Throwable
     */
    public BaseRteException(int errCode, Throwable throwable) {
        super(throwable.getMessage());
        this.errCode = errCode;
        this.errDesc = throwable.getMessage();
    }

    /**
     * 构造函数
     *
     * @param errCode    错误代码
     * @param errDesc 错误信息
     */
    public BaseRteException(int errCode, String errDesc) {
        super(errDesc);
        this.errCode = errCode;
        this.errDesc = errDesc;
    }



}
